﻿function install_qtip(url){
	var content;
	$('.img-pro').mouseover(function(){
		idpro = $(this).parent().prev().val();
	});		
	
	$('.img-pro').qtip({
			position: {
				corner: {
					target: 'topRight',
					tooltip: 'bottomLeft'
				},
				adjust:{screen:true, x: -30, y: 0}
			},
			style:{width:270,padding:10,tip:{corner:"bottomMiddle",color:"#555",size:{x:14,y:10}}},
			show:{delay:800,solo:true,effect:function(){$(this).stop(true,true).show()}},
			hide:{when:"mouseout",fixed:true,delay:300,effect:function(){$(this).stop(true,true).hide()}},
			api: {
					onRender: function() {
						var api = this;
						$.ajax({
								type: "GET",
								url: url+'duans/qtippro',
								dataType: 'json',
								data: {'idpro': idpro},
							   
								success: function(json){
									new_content = '<div>'+
														'<img class="img-qtip" src="'+url+'app/upload/'+json.hinhdaidien+'" width = "100" height = "100" />'+
														'<a class="title-qtip" href="/bat-dongsan/project-'+json.id+'/'+(json.tieude).replace(/ /gi, "-")+'.html">'+json.tieude+'</a>'+
														'<br />'+
														'<span class="address-qtip">'+json.diachi+'</span>'+
														'<br />'+
														'<div class="content-qtip">'+json.noidung+'</div>'+
													'</div>';
									//$('.tooltip').html(html_append);
									//var new_content = $('.tooltip').html();
									api.updateContent(new_content);
									$(".content-qtip").expander({
										slicePoint: 300,
										expandText: '',
										userCollapseText: ''
									});
								}
						//api.updateContent(content);
						});
								 
					}		
					
			},
			content: {
				prerender: false,
				text: ''
			},
		});
}